<div th:fragment="add">
    <div class="modal fade myDivClass" id="myModal1"   tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel"></h4>
                </div>
                <form id ="contentForm">
                <div class="modal-body">
                    <div class="form-group">
                        <label  class="control-label">图片名称:</label>
                        <input type="text" autocomplete="off"  class="form-control" placeholder="请输入图片名称"   name="name1">
                    </div>
                    <div class="form-group">
                        <label  class="control-label">上传图片:</label>
                        <section class="upload-section">
                            <img id="img1" class="imgs" name="wechatPic" th:src="@{/static/img/jiahao.JPG}"  />
                            <input  data-id="1" type="file"  class="image pic_path" name="wechatPics" style="display: inline !important;" multiple/>
                            <input id="pic_paths1" type="hidden"  name="picPath1" />
                        </section>
                    </div>

                </div>

                </form>
                <div class="modal-footer">
                    <button id="add" type="button" class="myDivClass btn btn-success">确定</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>

            </div>
        </div>
    </div>


    <script src="../static/js/upload.js" th:src="@{/static/js/upload.js}"></script>
    <script>
        $('#myModal1').on('hidden.bs.modal', function () {
            $('#Id').html('');
        });
        $('#myModal1').on('hidden.bs.modal', function (){
            document.getElementById("contentForm").reset();
        });
        //点击新增按钮弹出框
        $("#btn_add").click(function () {
            $("#myModalLabel").text("新增用户");
            $('#myModal1').modal();
        });
        //点击保存按钮
        $("#add").click(function(){
            const name = $("input[name='name1']").val();//获取输入的图片
            const picPath1 = $("input[name='picPath1']").val();//获取上传图片地址
            const data = {
                name: name,
                url: picPath1
            };
            //提交后台保存用户数据
            myrequest("/admin/picture/add",data,'POST',function(data){
                $('#myModal1').modal('hide')
                toastr.success(data.msg);
                $("#table").bootstrapTable('refresh');
            }, function(data){
                toastr.error(data.msg);
            })
        });

    </script>

</div>